<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>从键盘录入</title>
</head>
<body>
    <input type="text" id="user_name" name="username" placeholder="请输入用户名">
    <input type="text" id="age" name="age" placeholder=""请输入你的年龄>
    <button onclick="getInput()">
        提交
    </button>

</body>
    <script>
        function getInput(){
            var username = document.getElementById("user_name").value
            console.log(username)
            console.log(typeof username)
            var age = Number(document.getElementById("age").value)
            console.log(age)
            console.log(typeof age)
        }
        // var userName = prompt('请输入姓名：')
        // console.log(userName)
        // console.log(typeof (userName))
        // var age = Number(prompt('请输入年龄'))
        // console.log(age)
        // console.log(typeof (age))
    </script>
</html>